---
description: "Reference for Nitric's v0 Go library - Get a list of file references for files that exist in the bucket."
---

# Go - Bucket.Files()

Get a list of file references for files that exist in the bucket.

```go
import (
  "context"
  "fmt"

  "github.com/nitrictech/go-sdk/nitric"
)

func main() {
  bucket, err := nitric.NewBucket("bucket-name").With(nitric.BucketReading)
  if err != nil {
    return
  }

  files, err := bucket.Files(context.TODO())
  if err != nil {
    return
  }

  nitric.Run()
}
```

## Parameters

<Properties>
  <Property name="ctx" required type="context">
    The context of the call, used for tracing.
  </Property>
</Properties>

## Examples

Deleting all files in a bucket

```go
import (
  "context"
  "fmt"

  "github.com/nitrictech/go-sdk/nitric"
)

func main() {
  bucket, err := nitric.NewBucket("bucket-name").With(nitric.BucketReading)
  if err != nil {
    return
  }

  ctx := context.TODO()

  files, err := bucket.Files(ctx)
  if err != nil {
    fmt.Println(err)
    return
  }

  for _, file := range files {
    file.Delete(ctx)
  }

  nitric.Run()
}
```

## Notes

This method returns a list of [File](./bucket-file) references that exist on the bucket.
